<?php
 $uri_segment = $this->uri->segment(3);
 if($uri_segment != "" && $uri_segment != "all"){
    $option = parsing_param2($uri_segment);
    $awal = datefmysql($option['awal']);
    $akhir = datefmysql($option['akhir']);
    $adikAsuh = $option['AdikAsuh'];
    $idAdikAsuh = $option['idAdikAsuh'];
    $idTahunAjaran = $option['idTahunAjaran'];
 }else{
     $awal = date('d/m/Y');
     $akhir = date('d/m/Y');
     $adikAsuh = '';
     $idAdikAsuh = '';
     $idTahunAjaran = '';
 }
?>
<html>
    <head>
        <title>Cetak Laporan Log Adik Asuh</title>
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/style2.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/tabel.css" />
        <script type="text/javascript">
                function cetak() {
                        SCETAK.innerHTML = '';
                        window.print();
                        if (confirm('Apakah menu print ini akan ditutup?')) {
                                window.close();
                        }
                        SCETAK.innerHTML = '<br /><input onClick=\'cetak()\' type=\'submit\' name=\'Submit\' value=\'Cetak\' class=\'tombol\'>';
                }

        </script>
    </head>
    <body>
        <center>
            <h1>Laporan Log Adik Asuh</h1>
            <h2>Periode <?php echo indo_tgl($awal)?> s.d <?php echo indo_tgl($akhir)?></h2>
            <?php
              if($adikAsuh != ''){
            ?>
            <h2>Nama Adik Asuh : <?php echo "$adikAsuh";?></h2>
            <?php
              }
            if($idTahunAjaran != ''){
                foreach ($tahunAjaran as $row);
                echo "<h2>Tahun Ajaran : ".$row['nama'].' '.$row['semester'].'</h2>';
            }
            ?>
        </center>
        <div class="data-list">
            <table class="tabel" style="width: 100%">
                <tr>
                    <th>No</th>
                    <th>Tanggal</th>
                    <th>Petugas</th>
                    <th>Adik Asuh</th>
                    <th>Sekolah</th>
                    <th>Kelas</th>
                    <th>Tahun Ajaran</th>
                    <th>Komentar</th>
                </tr>
                <?php
                    $no = 1;
                    foreach ($listLogAdikAsuh as $rows){
                ?>
                <tr class="<?php echo ($no%2)?"even":"odd";?>">
                    <td style="text-align: center;width: 3%;"><?php echo $no++;?></td>
                    <td style="width: 10%"><?php echo datefmysql($rows['tanggal']);?></td>
                    <td style="width: 15%"><?php echo $rows['member'];?></td>
                    <td style="width: 15%"><?php echo $rows['adik_asuh'];?></td>
                    <td style="width: 20%"><?php echo $rows['sekolah'];?></td>
                    <td style="width: 5%"><?php echo $rows['kelas'];?></td>
                    <td style="width: 10%"><?php echo $rows['tahun_ajaran']." ".$rows['semester'];?></td>
                    <td style="text-align: justify"><?php echo $rows['komentar'];?></td>
                </tr>
                <?php
                    }
                ?>
            </table>
        </div>    
        <center><span id="SCETAK"><input type="button" class="tombol" value="Cetak" onClick="cetak()"/></span></center>
    </body>
</html>